//
//  searchHearderView.m
//  GiftItems
//
//  Created by lanou3g on 15/9/22.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "searchHearderView.h"

@implementation searchHearderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 64)];
        self.headerView.backgroundColor = kRGB(255.0, 151.0, 255.0);
        [self addSubview:self.headerView];
        
        //搜索框
        self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(60, 30, kWidth - 120, 24)];
        [self.searchBar setPlaceholder:@"搜索礼物和攻略"];
        
        UIImageView *imageSearch = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_share_large"]];
        
        [self.searchBar insertSubview:imageSearch atIndex:1];
        self.searchBar.layer.masksToBounds = YES;
        self.searchBar.layer.cornerRadius = 11;
//      [self.searchBar setBarStyle:UIBarStyleDefault];
        self.searchBar.backgroundColor = [UIColor clearColor];
        [self.headerView addSubview:self.searchBar];
        //搜索按钮
        self.searchButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.searchButton.frame = CGRectMake(kWidth - 50, 30, 40, 24);
        [self.searchButton setTitle:@"搜索" forState:(UIControlStateNormal)];
        self.searchButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:16];
        [self.searchButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
        [self.headerView addSubview:self.searchButton];
        
        //礼物按钮
        self.giftButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.giftButton.frame = CGRectMake(0, 64, kWidth / 2, 44);
        [self.giftButton setTitle:@"礼物" forState:(UIControlStateNormal)];
        [self.giftButton setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [self.giftButton setBackgroundImage:[UIImage imageNamed:@"bg_share_large"] forState:(UIControlStateNormal)];
        [self addSubview:self.giftButton];
        //礼物按钮下面的红线
        self.GiftLine = [[UIView alloc] initWithFrame:CGRectMake(0, 108, kWidth/2, 3)];
        self.GiftLine.backgroundColor = [UIColor redColor];
        [self addSubview:self.GiftLine];
        
        
    
        
        //攻略按钮
        self.strategyButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.strategyButton.frame = CGRectMake(kWidth / 2, 64, kWidth/ 2, 44);
        [self.strategyButton setTitle:@"攻略" forState:(UIControlStateNormal)];
        [self.strategyButton setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [self.strategyButton setBackgroundImage:[UIImage imageNamed:@"bg_share_large"] forState:(UIControlStateNormal)];
        [self addSubview:self.strategyButton];
        //攻略下面的红线
        self.strategLine = [[UIView alloc] initWithFrame:CGRectMake(kWidth / 2, 108, kWidth/2, 3)];
        self.strategLine.backgroundColor = [UIColor redColor];
        [self addSubview:self.strategLine];
        
        
        
        self.backButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.backButton.frame = CGRectMake(10, 20, 40, 40);
        [self.backButton setImage:[UIImage imageNamed:@"Entypo_e764(1)_64"] forState:(UIControlStateNormal)];
        self.backButton.tintColor = [UIColor whiteColor];
        [self addSubview:self.backButton];
        
        
        
        
    }
    return self;
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
